<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>QR-Code Clock</title>
    <link rel="stylesheet" href="code128.css" type="text/css" media="screen" charset="utf-8">
    <script src="code128.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
        (function(divId) {
            var  divElement ,oldOnLoad = window.onload  ;
            function getTimeString() {
                var pad = function(n) { return n < 10 ? '0' + n.toString(10) : n.toString(10); }
                    ,dt = new Date();
                return [pad(dt.getHours()), pad(dt.getMinutes()), pad(dt.getSeconds())].join(':');
            }

            function UpdateClock() {
                var timeText = getTimeString();
                divElement.innerHTML = code128(timeText);
            }
            window.onload = function() {
                divElement = document.getElementById(divId);
                UpdateClock();
                setInterval(UpdateClock, 1000);
                if (typeof oldOnLoad == 'function') oldOnLoad.apply(this, arguments);
            }
        })('div1');
    </script>

</head>
<body>
<input type="button" value ="生成"  onclick="createBarcode('div128','6921734972576','B');"/>
<div class="barcode2" id="div128" style="margin: 0 auto;padding-top: 200px;padding-left: 300px;"></div>
<div class="barcode2" id="div1"></div>
</body>
</html>